import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login/login.vue')
  },
  {
    path: '/',
    name: '/',
    meta: {
      title: '首页'
    },
    component: () => import('../layout'),
    redirect: '/client',
    children: [
      {
        path: '/client',
        name: 'client',
        meta: {
          title: '客户管理'
        },
        component: () => import('@/views/client/Client.vue')
      },
      {
        path: '/addClient',
        name: 'addClient',
        meta: {
          title: '添加/修改客户'
        },
        component: () => import('@/views/client/AddClient.vue')
      },
      {
        path: '/waterMan',
        name: 'waterMan',
        meta: {
          title: '送水工管理'
        },
        component: () => import('@/views/waterman/WaterMan.vue')
      },
      {
        path: '/addWaterMan',
        name: 'addWaterMan',
        meta: {
          title: '添加/修改送水工'
        },
        component: () => import('@/views/waterman/AddWaterMan.vue')
      },
      {
        path: '/history',
        name: 'history',
        meta: {
          title: '送水历史管理'
        },
        component: () => import('@/views/history/History.vue')
      },
      {
        path: '/addHistory',
        name: 'addHistory',
        meta: {
          title: '添加/修改送水历史信息'
        },
        component: () => import('@/views/history/AddHistory.vue')
      },
      {
        path: '/salary',
        name: 'salary',
        meta: {
          title: '计算工资'
        },
        component: () => import('@/views/salary/Salary.vue')
      },
      {
        path: '/waterCount',
        name: 'waterCount',
        meta: {
          title: '统计送水数量'
        },
        component: () => import('@/views/watercount/WaterCount.vue')
      },
      {
        path: '/updPwd',
        name: 'updPwd',
        meta: {
          title: '修改密码'
        },
        component: () => import('@/views/user/UpdPwd.vue')
      }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
